package com.tosit.driverschool.service;

import com.tosit.driverschool.dao.UserMapper;
import com.tosit.driverschool.dao.UserRepository;
import com.tosit.driverschool.common.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Autowired
   private UserRepository userRepository;
    @Override
    public List<User> findAll() {
        return userRepository.findAll();
    }

    @Override
    public User selectById(String id) {
        return userMapper.selectByPrimaryKey(id);
    }

    @Override
    public int deleteById(String id) {
        return userMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int upDate(User user) {
        return userMapper.updateByPrimaryKey(user);
    }

    @Override
    public User selectbyId(String id) {
        return userMapper.selectByPrimaryKey(id);
    }

    @Override
    public int add(User user) {
        return userMapper.insert(user);
    }


}
